package com.xhwl.data.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.xhwl.common.dto.auth.AuthenticationDTO;
import com.xhwl.common.dto.auth.LoginDTO;
import com.xhwl.common.dto.cent.sdata.*;
import com.xhwl.common.enums.config.RoleTypeEnum;
import com.xhwl.common.pojo.AbstractAccount;
import com.xhwl.common.pojo.ResultJson;
import com.xhwl.common.pojo.cent.sdata.*;
import com.xhwl.common.query.cent.AdminAccountQuery;
import com.xhwl.common.query.cent.sdata.*;
import com.xhwl.common.vo.cent.sdata.AccountCriteria;
import com.xhwl.common.vo.cent.sdata.AccountDetailVO;
import com.xhwl.common.vo.cent.sdata.AccountSearchVO;
import com.xhwl.common.vo.cent.sdata.RoleDetailVO;
import com.xhwl.data.pojo.AccountOperatorAuth;
import feign.RequestLine;
import org.springframework.web.bind.annotation.*;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * @Author: JCccc
 * @Description:
 * @Date: Create in 17:10 2021/05/26
 */
@RestController
public interface IAccountService extends IService<Account> {


    /**
     * 账号查询 （分页） , 可根据企业、项目、角色等条件查询
     *
     * @param page
     * @param accountQuery
     * @return
     */
    @PostMapping(value = "/account-service/view-page-list")
    Page<AccountDTO> getPageList(@RequestPart(value = "page", required = false) Page page, @RequestPart("accountQuery") AccountQuery accountQuery);

    /**
     * 账号查询（不分页） , 可根据企业、项目、角色等条件查询
     *
     * @param accountQuery
     * @return
     */
    @PostMapping(value = "/account-service/view-list")
    List<AccountDTO> getList(@RequestPart("accountQuery") AccountQuery accountQuery);

    /**
     * 通过手机号查账号信息
     *
     */
    @PostMapping(value = "/account-service/getListByPhones")
    Page<Account> getAccountsByPhones(@RequestPart Page page,@RequestPart("phones") List<String> phones);


    /**
     * 获取被访人身份信息
     * @param industryId
     * @param accountSearch
     * @param account
     * @return getAccessedList
     */
    @PostMapping(value = "/account-service/get-accessed-list")
    List<AccountDTO>getAccessedList(@RequestPart(value = "industryId",required = false) Short industryId, @RequestPart("accountSearch") AccountSearchVO accountSearch, @RequestPart("account") Account account);

    /**
     * 动态获取用户组账号数据 (分页)
     *
     * @param page
     * @param groupAccountQuery
     * @return
     */
    @PostMapping(value = "/account-service/group-accounts")
    Page<GroupAccountDTO> getGroupAccountDynamic(@RequestPart(value = "page", required = false) Page page, @RequestPart("groupAccountQuery") GroupAccountQuery groupAccountQuery);


    /**
     * 内置角色维度分组 账号列表
     *
     * @param accountQuery
     * @return
     */
    @PostMapping(value = "/account-service/group-by-initialize-role")
    List<RoleDetailVO> getAccountWithInitializeRoles(@RequestPart("accountQuery") AccountQuery accountQuery);

    /**
     * 编辑账号单表信息
     *
     * @param account
     * @return
     */
    @RequestMapping(value = "/account-service/edit-account-info", method = RequestMethod.POST)
    ResultJson editAccountInfo(@RequestPart("account") Account account);


    /**
     * 根据角色分组，查询账号
     *
     * @param accountRoleQuery
     * @return
     */
    ResultJson listGroupByRole(AccountRoleQuery accountRoleQuery);


    /**
     * 重置密码 （xh123456）
     *
     * @param operateAccountId
     * @param id
     * @return
     */
    @PostMapping(value = "/account-service/reset-pwd")
    ResultJson resetPwd(@RequestPart(value = "operateAccountId", required = false) Integer operateAccountId, @RequestPart("id") Integer id);

    /**
     * 初次登录-密码修改
     *
     * @param id
     * @param pwd
     * @return
     */
    @PostMapping(value = "/account-service/modify-pwd")
    ResultJson modifyPwd(Integer id, String pwd);

    /**
     * 修改邮箱
     *
     * @param industryId
     * @param id
     * @param email
     * @return
     */
    @PostMapping(value = "/account-service/modify-email")
    ResultJson modifyEmail(@RequestPart(value = "industryId", required = false) Short industryId, @RequestPart("id") Integer id, @RequestPart("email") String email);

    /**
     * 编辑头像
     *
     * @param id
     * @param headImg
     * @return
     */
    @PostMapping(value = "/account-service/edit-head-img")
    ResultJson editHeadImg(Integer id, String headImg);

    /**
     * 设置账号初次登录状态为已经登录
     *
     * @param id
     * @return
     */
    @PostMapping(value = "/account-service/set-logged")
    ResultJson setLogged(@RequestPart("id") Integer id);

    /**
     * 设置账号勾选过协议
     *
     * @param id
     * @return
     */
    @PostMapping(value = "/account-service/set-protocol")
    ResultJson setProtocol(@RequestPart("id") Integer id);

    /**
     * 密码校验
     *
     * @param id
     * @param pwd
     * @return
     */
    @PostMapping(value = "/account-service/verify-pwd")
    ResultJson verifyPwd(Integer id, String pwd);

    /**
     * 修改个人信息 -个人中心
     *
     * @param account
     * @return
     */
    @PostMapping(value = "/account-service/modify-personalInfo")
    ResultJson modifyPersonalInfo(@RequestPart("account") Account account);

    /**
     * 根据角色id查找 关联的账号id列表
     *
     * @param roleId
     * @return
     */
    @PostMapping(value = "/account-service/list-by-role")
    List<Integer> getAccountIdListByRoleId(@RequestPart("id") Integer roleId);


    /**
     * 根据业态id获取出业态普通内置角色里面的角色值
     *
     * @param industryId
     * @return
     */
    @PostMapping(value = "/account-service/get-common-init-roles")
    List<Map<String, Object>> getCommonInitRoleEnumList(@RequestPart("industryId") Short industryId);


    /**
     * 创建账号 旧方法 默认新增权限组
     *
     * @param account
     * @param enterpriseIds
     * @param projectIds
     * @param roleIds
     * @return
     */
    @PostMapping(value = "/account-service/create-account")
    ResultJson<Integer> createAccount(
            @RequestPart("account") Account account,
            @RequestPart(value = "enterpriseIds", required = false) List<Integer> enterpriseIds,
            @RequestPart(value = "projectIds", required = false) List<Integer> projectIds,
            @RequestPart(value = "roleIds", required = false) List<Integer> roleIds);

    /**
     * 创建帐号 新增权限组概念后的新方法
     *
     * @param account
     * @param relation
     * @return
     */
    @PostMapping(value = "/account-service/create-accountV2")
    ResultJson<Integer> createAccountV2(
            @RequestPart("account") Account account,
            @RequestPart("relation") AccountRelation relation,
            @RequestPart(value = "permissionGroup") List<PermissionGroupDTO> permissionGroupDTOList);


    /**
     * 第三方账号开户 （创建账号 & 绑定 第三方openId）
     *
     * @param establishOpenAccount
     * @return
     */
    @PostMapping(value = "/account-service/establish-account")
    ResultJson establishOpenAccount(@RequestPart("establishOpenAccount") EstablishOpenAccount establishOpenAccount);


    /**
     * 删除某个账号 （无权限校验）
     *
     * @param accountId
     * @return
     */
    @PostMapping(value = "/account-service/delete-core-account")
    ResultJson deleteCoreAccount(@RequestPart("accountId") Integer accountId);


    /**
     * 更新某个账号 （无权限校验）
     *
     * @param account
     * @param enterpriseIds
     * @param projectIds
     * @param roleIds
     * @return
     */
    @PostMapping(value = "/account-service/update-core-account")
    ResultJson updateCoreAccount(@RequestPart("account") Account account,
                                 @RequestPart("enterpriseIds") List<Integer> enterpriseIds,
                                 @RequestPart(value = "projectIds", required = false) List<Integer> projectIds,
                                 @RequestPart("roleIds") List<Integer> roleIds);

    /**
     * 为某个账号添加项目关联
     *
     * @param accountId
     * @param projectIds
     * @return
     */
    void addProjectToAccount(Integer accountId, List<Integer> roles, List<Integer> projectIds);

    /**
     * 给帐号添加角色
     * @param accountId
     * @param roleIds
     * @return
     */
    ResultJson addRole(Integer accountId, List<Integer> roleIds);

    /**
     * 移除帐号关联的角色
     * @param accountId
     * @param roleIds
     * @return
     */
    ResultJson removeRole(Integer accountId, List<Integer> roleIds);

    /**
     * 获取某个账号的 内置角色数据关系
     *
     * @param id
     * @return
     */
    @RequestMapping(value = "/account-service/common-init-roles-relation", method = RequestMethod.POST)
    ResultJson getAccountCommonInitRoles(@RequestPart("id") Integer id);

    /**
     * 判断当前账号是否 为此项目的管理员 / 此项目所属企业的管理员 / 超管
     *
     * @param id
     * @param projectId
     * @return
     */
    @PostMapping(value = "/account-service/is-admin-check")
    ResultJson isAdminCheck(@RequestPart("id") Integer id, @RequestPart("projectId") Integer projectId);


    /**
     * 生成游客账号
     *
     * @param account
     * @return
     */
    @RequestMapping(value = "/account-service/generate-visitor", method = RequestMethod.POST)
    ResultJson generateVisitor(
            @RequestPart("account") Account account,
            @RequestPart(value = "projectIds", required = false) List<Integer> projectIds);

    /**
     * 批量插入
     *
     * @param accountList
     * @return
     */
    @PostMapping(value = "/account-service/create-account-batch")
    ResultJson<Map<String, Integer>> createAccountBatch(@RequestPart(value = "accountList", required = false) List<AccountBatchDTO> accountList);

    /**
     * 批量删除账号
     *
     * @param accountIds
     * @return
     */
    @PostMapping(value = "/account-service/delete-core-account-batch")
    ResultJson deleteCoreAccountBatch(@RequestPart("accountIds") List<Integer> accountIds);


    /**
     * 修改账号 旧方法 默认修改权限组
     *
     * @param operateAccount
     * @param account
     * @param enterpriseIds
     * @param projectIds
     * @param roleIds
     * @return
     */
    @PostMapping(value = "/account-service/update-account")
    ResultJson updateAccount(@RequestPart("operateAccount") Account operateAccount, @RequestPart("account") Account account, @RequestPart("enterpriseIds") List<Integer> enterpriseIds, @RequestPart("projectIds") List<Integer> projectIds, @RequestPart("roleIds") List<Integer> roleIds);


    /**
     * 修改账号（新）支持权限组传参
     *
     * @param operateAccount         操作人
     * @param account
     * @param relation               企业 项目 角色 与账号相关的信息
     * @param permissionGroupDTOList
     * @return
     */
    @PostMapping(value = "/account-service/update-accountV2")
    ResultJson updateAccountV2(@RequestPart("operateAccount") Account operateAccount,
                               @RequestPart("account") Account account,
                               @RequestPart("relation") AccountRelation relation,
                               @RequestPart(value = "permissionGroup") List<PermissionGroupDTO> permissionGroupDTOList);

    /**
     * 修改账号内置角色相关联信息
     *
     * @param operateAccount
     * @param account
     * @param enterpriseIds
     * @param projectIds
     * @param roleIds
     * @return
     */
    @PostMapping(value = "/account-service/update-common-initialize-roles")
    ResultJson updateCommonInitializeRole(@RequestPart("operateAccount") Account operateAccount, @RequestPart("account") Account account, @RequestPart("enterpriseIds") List<Integer> enterpriseIds, @RequestPart("projectIds") List<Integer> projectIds, @RequestPart("roleIds") List<Integer> roleIds);

    /**
     * 删除账号内置角色相关联信息、项目信息
     *
     * @param operateAccount
     * @param accountId
     * @param projectId
     * @param roleIds
     * @param deleteRole
     * @return
     */
    @PostMapping(value = "/account-service/delete-common-initialize-roles")
    ResultJson deleteCommonInitializeRole(@RequestPart(value = "operateAccount", required = false) Account operateAccount, @RequestPart("accountId") Integer accountId, @RequestPart("projectId") Integer projectId, @RequestPart("roleIds") List<Integer> roleIds, @RequestPart("deleteRole") Boolean deleteRole);


    /**
     * 删除账号
     *
     * @param operateAccount
     * @param accountId
     * @return
     */
    @PostMapping(value = "/account-service/delete-account")
    ResultJson deleteAccount(@RequestPart("operateAccount") Account operateAccount, @RequestPart("accountId") Integer accountId);

    /**
     * 普通账号、权限信息获取
     *
     * @param loginDTO
     * @return
     */
    @PostMapping(value = "/account-service/get-common-account")
    AuthenticationDTO getCommonAccountInfo(@RequestPart("loginDTO") LoginDTO loginDTO);


    /**
     * 系统运维后台账号信息获取
     *
     * @param loginName
     * @return
     * @deprecated 引入开放平台后后台的账号就不能单独的根据账号名获取了
     */
    @Deprecated
    @RequestMapping(value = "/account-service/get-admin-account", method = RequestMethod.POST)
    AuthenticationDTO getAdminAccountInfo(String loginName);

    @RequestMapping(value = "/account-service/get-admin-accountV2", method = RequestMethod.POST)
    AuthenticationDTO getAdminAccountInfoV2(@RequestPart("accountQuery") AdminAccountQuery accountQuery);


    @RequestMapping(value = "/account-service/get-admin-account-phone", method = RequestMethod.POST)
    AuthenticationDTO getAdminAccountByPhone(String phone);

    /**
     * 获取账号与企业相关信息
     *
     * @param enterpriseIdList
     * @param accountIdList
     * @return
     */
    @RequestMapping(value = "/account-service/query-account-enterprise", method = RequestMethod.POST)
    List<AccountDetailDTO> getAccountEnterpriseInfoByIdList(@RequestPart(value = "enterpriseIdList", required = false) List<Integer> enterpriseIdList, @RequestPart("accountIdList") List<Integer> accountIdList);

    /**
     * 根据帐号查询企业
     */
    @RequestMapping(value = "/account-service/find-ent-map", method = RequestMethod.POST)
    Map<Integer,List<Enterprise>> findEnterpriseMap(@RequestPart List<Integer> accountIds);

    /**
     * 获取账号与角色相关信息
     *
     * @param accountIdList
     * @param roleIdList    这个方法升级了  ,有使用需要的可以用 getAccountRoleDynamic，支持更多动态条件搜索
     * @return
     */
    @Deprecated
    @RequestMapping(value = "/account-service/query-account-role", method = RequestMethod.POST)
    List<AccountDetailDTO> getAccountRoleInfoByIdList(@RequestPart("accountIdList") List<Integer> accountIdList, @RequestPart("roleIdList") List<Integer> roleIdList);


    /**
     * 账号、角色 两张表联表 查询
     *
     * @param accountRoleQuery
     * @return
     */
    List<AccountDetailDTO> getAccountRoleDynamic(AccountRoleQuery accountRoleQuery);

    /**
     * 获取账号与角色相关信息 分页
     *
     * @param accountIdList
     * @param roleIdList
     * @return
     */
    @RequestMapping(value = "/account-service/query-account-role-page", method = RequestMethod.POST)
    Page<AccountDetailDTO> getPageAccountRoleInfoByIdList(Page page, @RequestPart("accountIdList") List<Integer> accountIdList, @RequestPart("roleIdList") List<Integer> roleIdList);


    /**
     * 获取账号与项目相关信息
     *
     * @param accountIdList
     * @return
     */
    @RequestMapping(value = "/account-service/query-account-project", method = RequestMethod.POST)
    List<AccountDetailDTO> getAccountProjectInfoByIdList(@RequestPart("accountIdList") List<Integer> accountIdList);


    /**
     * 动态查找单个账号
     *
     * @param operateAccount
     * @param accountQuery
     * @return
     */
    @RequestMapping(value = "/account-service/get-one", method = RequestMethod.POST)
    Account getAccount(@RequestPart(value = "operateAccount", required = false) Account operateAccount, @RequestPart("accountQuery") AccountQuery accountQuery);

    /**
     * 根据id查找单个账号
     *
     * @param id
     * @return
     */
    @PostMapping(value = "/account-service/get-by-id")
    Account findById(@RequestPart(value = "id") Integer id);


    /**
     * 根据账号登录名查找账号
     *
     * @param loginName
     * @param industryId
     * @return
     */
    Account findByLoginName(String loginName, Short industryId);

    /**
     * 根据账号登录名称查找账号
     * @param loginName
     * @param developId
     * @return
     */
    Account findByLoginNameV2(String loginName, Integer developId);

    /**
     * 系统运维后台-账号查找
     *
     * @param roleQuery
     * @param accountQuery
     * @param page
     * @return
     */
    @RequestMapping(value = "/account-service/page-role", method = RequestMethod.POST)
    Page<AccountDTO> pageListByRole(@RequestPart(value = "roleQuery", required = false) RoleQuery roleQuery, @RequestPart(value = "accountQuery", required = false) AccountQuery accountQuery, @RequestPart Page page);


    /**
     * 移除账号的某个角色（关联数据）
     *
     * @param accountId
     * @param roleId
     * @return
     */
    @PostMapping(value = "/account-service/remove-assign-role")
    ResultJson removeAssignRole(Integer accountId, Integer roleId);

    /**
     * 业态下 账号唯一、手机号、邮箱唯一校验
     *
     * @param account
     */
    void accountUnique(Account account);


    /**
     * 获取当前账号的角色信息
     *
     * @param id
     * @return
     */
    @RequestMapping(value = "/account-service/get-roles", method = RequestMethod.POST)
    List<AccountRolesDTO> getAccountRoles(Integer id);

    /**
     * 根据帐号查询角色名称
     *
     * @param accountIds
     * @return
     */
    Map<Integer, List<String>> getAccountRoles(List<Integer> accountIds);

    /**
     * 获取当前账号的项目信息
     *
     * @param id
     * @return
     */
    List<AccountProjectsDTO> getAccountProjects(Integer id);

    /**
     * 根据角色名称、业态id 查找关联的项目id
     *
     * @param roleName
     * @param industryId
     * @return
     */
    List<Integer> getProjectIdListByRoleName(String roleName, Short industryId);

    /**
     * 根据项目名、业态id 查找关联的项目id
     *
     * @param projectName
     * @param industryId
     * @return
     */
    List<Integer> getProjectIdListByProjectName(String projectName, Short industryId);

    /**
     * 根据企业名、业态id 查找关联的项目id
     *
     * @param enterpriseName
     * @param industryId
     * @return
     */
    List<Integer> getProjectIdListByEnterpriseName(String enterpriseName, Short industryId);

    /**
     * 账号详情
     *
     * @param operateAccount
     * @param id
     * @return
     */
    @GetMapping(value = "/account-service/getDetail")
    AccountDetailVO getDetail(@RequestPart(value = "industryId") Short industryId, @RequestPart(value = "operateAccount") Account operateAccount, @RequestPart(value = "id") Integer id);

    /**
     * 修改手机号
     *
     * @param operateAccount
     * @param accountPersonalDTO
     * @return
     */
    @PostMapping(value = "/account-service/phone-edit")
    ResultJson phoneEdit(@RequestPart(value = "operateAccount") Account operateAccount, @RequestPart(value = "accountPersonalDTO") AccountPersonalDTO accountPersonalDTO);


    /**
     * 修改账号时的权限范围检测
     *
     * @param industryId
     * @param operateRoleType
     * @param updateAccountRoleType
     * @return
     */
    Boolean updateAccountCheck(Short industryId, RoleTypeEnum operateRoleType, RoleTypeEnum updateAccountRoleType);


    /**
     * 删除账号时的权限范围检测
     *
     * @param industryId
     * @param operateRoleType
     * @param updateAccountRoleType
     * @return
     */
    Boolean deleteAccountCheck(Short industryId, RoleTypeEnum operateRoleType, RoleTypeEnum updateAccountRoleType, AccountOperatorAuth accountOperatorAuth);


    /**
     * 检测当前账号是否能操作当前项目
     *
     * @param account
     * @param projectId
     * @return
     */
    @PostMapping(value = "/account-service/check-operate-project")
    ResultJson<Boolean> checkOperateProject(@RequestPart(value = "account", required = false) Account account, @RequestPart(value = "projectId", required = false) Integer projectId);


    /**
     * 单表动态查询-分页
     *
     * @param operateAccount
     * @param page
     * @param accountQuery
     * @return
     */
    @PostMapping(value = "/account-service/page-list")
    Page<Account> getAccountPageList(@RequestPart(value = "operateAccount", required = false) Account operateAccount, @RequestPart("page") Page page, @RequestPart("accountQuery") AccountQuery accountQuery);


    /**
     * 单表动态查询-不分页
     *
     * @param operateAccount
     * @param accountQuery
     * @return
     */
    @PostMapping(value = "/account-service/list")
    List<Account> getAccountList(@RequestPart(value = "operateAccount", required = false) Account operateAccount, @RequestPart("accountQuery") AccountQuery accountQuery);

    /**
     * 创建管理账号
     *
     * @param account
     * @param enterpriseIds
     * @param projectIds
     * @param roleIds
     * @return
     */
    @RequestMapping(value = "/account-service/create-account-admin", method = RequestMethod.POST)
    ResultJson createAccountAdmin(
            @RequestPart("account") Account account,
            @RequestPart(value = "enterpriseIds", required = false) List<Integer> enterpriseIds,
            @RequestPart(value = "projectIds", required = false) List<Integer> projectIds,
            @RequestPart(value = "roleIds", required = false) List<Integer> roleIds);


    /**
     * 修改管理账号
     *
     * @param account
     * @param enterpriseIds
     * @param projectIds
     * @param roleIds
     * @return
     */
    @RequestMapping(value = "/account-service/update-account-admin", method = RequestMethod.POST)
    ResultJson updateAccountAdmin(
            @RequestPart("account") Account account,
            @RequestPart(value = "enterpriseIds", required = false) List<Integer> enterpriseIds,
            @RequestPart(value = "projectIds", required = false) List<Integer> projectIds,
            @RequestPart(value = "roleIds", required = false) List<Integer> roleIds
    );

    /**
     * 删除管理账号
     *
     * @param accountId
     * @return
     */
    @RequestMapping(value = "/account-service/delete-account-admin", method = RequestMethod.POST)
    ResultJson deleteAccountAdmin(Integer accountId);

    /**
     * 动态查找 超管、企管、项管
     *
     * @param roleType
     * @param roleGrade
     * @param accountIdList
     * @return
     */
    List<Integer> getAdminAccountDynamic(Integer roleType, Short roleGrade, List<Integer> accountIdList);

    @Deprecated
    Page<Account> page(AccountCriteria accountCriteria, Page page);

    /**
     * 分页查询
     * 简单查询
     * @param accountQuery
     * @param page
     * @return
     */
    @RequestMapping(value = "/account-service/page", method = RequestMethod.POST)
    Page<AccountDTO> page(@RequestPart("accountQuery") AccountQuery accountQuery, @RequestPart("page") Page page);

    /**
     * 重构 getPageList 查询
     * 用于帐号的复杂条件分页查询
     * 后续条件在这个接口下扩展
     * @param accountQuery
     * @param page
     * @return
     */
    @RequestMapping(value = "/account-service/complex-page", method = RequestMethod.POST)
    Page<AccountDTO> complexPage(@RequestPart("accountQuery") AccountQuery accountQuery, @RequestPart("page") Page page);
    /**
     * 不存在 return null
     *
     * @param phone
     * @param industryId
     * @return
     *
     * @deprecated 用phoneExistV2代替 手机号不再业态下唯一
     */
    @Deprecated
    Account phoneExist(String phone, Short industryId);

    Account phoneExistV2(String phone, Integer developId);

    Map<Integer, Boolean> updateAccountCheckBatch(Short industryId, RoleTypeEnum operateRoleType, List<Integer> accountIdList);

    Map<Integer, Boolean> deleteAccountCheckBatch(Short industryId, RoleTypeEnum operateRoleType, List<Integer> accountIdList,Integer enterpriseId);

    @RequestMapping(value = "/account-service/find-by-space", method = RequestMethod.POST)
    Map<Integer, List<Account>> findBySpace(@RequestPart("organizationQuery") OrganizationQuery organizationQuery);

    /**
     * 不通过权限限制 直接更新账号和关联表信息
     *
     * @param operator        操作人
     * @param account
     * @param accountRelation 与账号有关系的关联表
     * @param asList          权限组
     * @return
     */
    ResultJson updateAccountAdminV2(AbstractAccount operator, Account account, AccountRelation accountRelation, List<PermissionGroupDTO> asList);

    /**
     * 更新账号表
     *
     * @param operator
     * @param account
     * @return
     */
    ResultJson updateAccount(AbstractAccount operator, Account account);

    /**
     * 设置登录时间
     *
     * @return
     */
    @RequestMapping(value = "/account-service/set-login-time", method = RequestMethod.POST)
    ResultJson setLoginTime(@RequestPart("id") Integer id);

    /**
     * 根据角色id查询帐号
     *
     * @param collect
     * @return map:roleId accounts
     */
    Map<Integer, List<Account>> getByRoleIds(List<Integer> collect);
    /**
     * 仅为奥莱主数据同步定制需求更新员工信息使用
     * @param account
     * @return
     */
    @RequestMapping(value = "/account-service/updateAccountById", method = RequestMethod.POST)
    void updateByAccountID(@RequestPart Account account);

    ResultJson<List<AccountDTO>> managersByAccountId(String loginName, Integer developId,Integer enterpriseId);

    ResultJson<Account> findHigherUp( String loginName, Integer grade, Integer developId,Integer enterpriseId);

    ResultJson checkAccount(List<String> loginNames, Integer developId);

    /**
     * 帐号详情
     * @param accountQuery
     * @return
     */
    AccountDetailVO getDetail(AccountQuery accountQuery);

    /**
     * 根据开发者ID查询账号列表
     * @param developerId
     * @return
     */
    @PostMapping("/account-service/list-by-developer-id")
    List<Account> listByDeveloperId(@RequestParam("developerId") Integer developerId);

    @RequestMapping(value = "/account-service/getListByRoleIds", method = RequestMethod.POST)
    List<AccountDTO> getListByRoleIds(@RequestPart("roleIds") List<Integer> roleIds);

    @PostMapping("/account-service/register")
    ResultJson register(@RequestPart("app")App app,@RequestPart(value = "industryId",required = false)Short industryId,@RequestPart("accountRegisterDTO")AccountRegisterDTO accountRegisterDTO);

    /**
     * 获取帐号关联的企业信息
     * @param id
     * @return
     */
    List<Integer> getEnterpriseIds(Integer id);

    ResultJson batchAuth(PermissionGroupDTO permissionGroupDTO);
}
